﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!-- <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <link href="css/demo.css" rel="stylesheet" type="text/css" /> 
    <script src="scripts/boot.js" type="text/javascript"></script>  
    <link href="scripts/miniui/themes/icons.css" rel="stylesheet" type="text/css"/>
	<link href="scripts/miniui/themes/default/miniui.css" rel="stylesheet" type="text/css"/>
	<script src="scripts/jquery-1.6.2.min.js" type="text/javascript" ></script> 
	<script src="scripts/miniui/miniui.js" type="text/javascript" ></script> 
    引入皮肤样式
    <link href="scripts/miniui/themes/blue/skin.css" rel="stylesheet" type="text/css" /> -->
    <style type="text/css">
    	.mini-grid-cell-inner, .mini-grid-headerCell-inner {
		    font-size: 11pt;
		    line-height: 29.1px;
		}
    </style>
</head>
<body>
    <!-- <div style="width:98%;">
        <div class="mini-toolbar" style="border-bottom:0;padding:0px;">
            <table style="width:100%;">
                <tr>
                    <td style="width:100%;">
                        <a class="mini-button" iconCls="icon-add" onclick="addRow()" plain="true">增加</a>
                        <a class="mini-button" iconCls="icon-remove" onclick="removeRow()" plain="true">删除</a>
                        <span class="separator"></span>
                        <a class="mini-button" iconCls="icon-save" onclick="saveData()" plain="true">保存</a>            
                    </td>
                    <td style="white-space:nowrap;">
						<input type="text" id="key"  class="mini-textbox" emptyText="search" style="width:150px;"/>
        				<input type="button" value="查询" onclick="search()"/>
                        <a class="mini-button" onclick="Sqlsearch()">查询</a>
                    </td>               
                </tr>
                
            </table>           
        </div>
    </div>
    <div id="datagrid1" class="mini-datagrid" style="width:98%;height:400px;" 
       url="GetTimerTaskListServlet?data=&runmethod=DBsearchTaskDeatails"  idField="id" pageSize="10" 
        allowCellEdit="true" allowCellSelect="true" multiSelect="true" editNextOnEnterKey="true" 
        allowCellValid="true">
        <div property="columns">
            <div type="checkcolumn"></div>
            <div field="job" vtype="required" width="15%" headerAlign="center" allowSort="true">工程
                <input  class="mini-textbox" style="width:100%;"/>
            </div>                   
            <div field="cases" vtype="required" width="30%" headerAlign="center" >用例
                <input class="mini-textbox" style="width:100%;" 
                    />                
            </div> 
            <div field="mailers" vtype="required" width="25%" headerAlign="center" >收件人
                <input property="editor" class="mini-treeselect" url="report/智能管车_web线上/智能管车_web线上.txt" multiSelect="true" 
                textField="name" valueField="id" parentField="pId" allowInput="true"
            	/>       
            	 <input class="mini-textbox" style="width:100%;"/>    
            </div>  
            <div name="type" field="type" vtype="required" width="5%" allowSort="true" renderer="onGenderRenderer" headerAlign="center">执行类型
                <input property="editor" class="mini-combobox" style="width:100%;" data="Genders"/>                
            </div>   
            <div name="runtime" field="runtime" vtype="required" width="10%" allowSort="true" headerAlign="center" dateFormat="HH:mm:ss">执行时间
                <input property="editor" class="mini-timespinner" format="HH:mm:ss" style="width:100%;"/>
            </div>  
            <div field="deleted" vtype="required" width="10%" headerAlign="center" allowSort="true" renderer="onClosedRenderer">状态
                <input class="mini-combobox" style="width:100%;" data="cloesdlist"/>                           
            </div>        
        </div>
    </div>
    <script type="text/javascript">
        mini.parse();

        var grid = mini.get("datagrid1");
        grid.load();
        
        var Genders = [{ id: 1, text: '每天' }, { id: 0, text: '一次'}];
        function onGenderRenderer(e) {
            for (var i = 0, l = Genders.length; i < l; i++) {
                var g = Genders[i];
                if (g.id == e.value) return g.text;
            }
            return "";
        }
        
        var closedlist = [{ id: 1, text: '已失效' }, { id: 0, text: '生效中'}];
        function onClosedRenderer(e) {
            for (var i = 0, l = closedlist.length; i < l; i++) {
                var g = closedlist[i];
                if (g.id == e.value) return g.text;
            }
            return "";
        }
        
        function search() {
            var key = mini.get("key").getValue();
            grid.load({ key : key });
        }
        function onKeyEnter(e) {
            search();
        }
        ////////////////////////////
        function editRow() {
            var rows = grid.getSelecteds();

            if (rows.length > 0) {
            
                for (var i = 0, l = rows.length; i < l; i++) {
                    var row = rows[i];
                    grid.beginEditRow(row);
                }
            } 
        }
        function addRow() {
            var newRow = {};
            grid.addRow(newRow, 0);
            grid.validateRow(newRow);
        }
        function removeRow() {
            var rows = grid.getSelecteds();
            if (rows.length > 0) {
                grid.removeRows(rows, true);
            }
        }
        function saveData() {     	
        	grid.validate();
            if (grid.isValid() == false) {
                alert("请校验输入单元格内容");
                var error = grid.getCellErrors()[0];
                grid.beginEditCell(error.record, error.column);
                return;
            }      	
            var data = grid.getChanges();
            var json = mini.encode(data);
            var method = "saveData";
			grid.commitEdit();
			grid.loading("保存中，请稍后......");
            $.ajax({
                url: "GetTimerTaskListServlet",
                data: { data: json ,runmethod:method},
                type: "post",
                success: function (text) {
                	grid.reload();
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    alert(jqXHR.responseText);
                }
            }); 
        }

    </script> -->
	<script src="js/common.js"></script>
</body>
</html>